(function(e) {
    var t = {
        id: "a885f4bbc2596be3fa9a7115633a99f9",
        filename: "hb-toast.js",
        exports: {}
    };
    if (!e.____MODULES) {
        e.____MODULES = {}
    }
    var a = function(e, t, a) {
        function i() {}
        i.prototype.inform = function(e, t) {
            var a = this;
            if (!document.getElementById("js-mask")) {
                a.mask = document.createElement("div");
                a.bubble = document.createElement("div");
                a.mask.setAttribute("id", "js-mask");
                a.bubble.setAttribute("id", "js-bubble");
                document.body.appendChild(a.mask);
                document.body.appendChild(a.bubble)
            }
            a.mask.style.display = "block";
            a.bubble.style.display = "inline-block";
            a.bubble.innerHTML = e || "";
            setTimeout(function() {
                a.mask.style.opacity = .5;
                a.bubble.style.opacity = .75
            }, 0);
            var i = 0;
            var r = new RegExp(/^[1-9]\d*$/);
            if (t && r.test(t)) {
                i = parseInt(t)
            }
            setTimeout(function() {
                a.mask.style.opacity = 0;
                a.bubble.style.opacity = 0
            }, 1e3 + i);
            setTimeout(function() {
                a.mask.style.display = "none";
                a.bubble.style.display = "none"
            }, 2e3 + i)
        }
        ;
        t.exports = new i
    }(t.exports, t, e);
    e.____MODULES["a885f4bbc2596be3fa9a7115633a99f9"] = t.exports
}
)(this);
(function(i) {
    var e = {
        id: "70b72683c19a23f446551c351d15254b",
        filename: "index.js",
        exports: {}
    };
    if (!i.____MODULES) {
        i.____MODULES = {}
    }
    var t = function(e, t, a) {
        t.exports = i.____MODULES["a885f4bbc2596be3fa9a7115633a99f9"]
    }(e.exports, e, i);
    i.____MODULES["70b72683c19a23f446551c351d15254b"] = e.exports
}
)(this);
(function(e) {
    var t = {
        id: "153b7aa5c1d187fe7c4e96e56858d461",
        filename: "ajax.js",
        exports: {}
    };
    if (!e.____MODULES) {
        e.____MODULES = {}
    }
    var a = function(e, t, a) {
        function r(e, t, a) {
            if (Object.prototype.toString.call(t) === "[object Array]" || Object.prototype.toString.call(t) === "[object Arguments]") {
                for (var i in t) {
                    r(e + "[" + (i != null ? i : "") + "]", t[i], a)
                }
            } else if (Object.prototype.toString.call(t) === "[object Object]") {
                for (i in t) {
                    r(e + "[" + i + "]", t[i], a)
                }
            } else if (Object.prototype.toString.call(t) === "[object Error]") {
                r(e, t.toString(), a)
            } else {
                a(e, t)
            }
        }
        function i(e) {
            var a = [];
            var t = function(e, t) {
                a.push(encodeURIComponent(e) + "=" + encodeURIComponent(t))
            };
            for (var i in e) {
                r(i, e[i], t)
            }
            a.push(("randomNumber=" + Math.random()).replace(".", ""));
            return a.join("&")
        }
        function o(t) {
            t = t || {};
            t.type = (t.type || "get").toUpperCase();
            t.dataType = t.dataType || "json";
            t.async = t.async || true;
            t.cache = t.cache || false;
            t.isNotShowErrorAlert = t.isNotShowErrorAlert || false;
            var e = i(t.data);
            var a;
            if (window.XMLHttpRequest) {
                a = new XMLHttpRequest
            } else {
                a = new ActiveXObject("Microsoft.XMLHTTP")
            }
            a.onreadystatechange = function() {
                if (a.readyState == 1) {
                    if (!t.cache) {
                        a.setRequestHeader("Cache-Control", "no-cache")
                    }
                    t.beforeSend && t.beforeSend()
                } else if (a.readyState == 2) {} else if (a.readyState == 3) {} else if (a.readyState == 4) {
                    var e = a.status;
                    if (e >= 200 && e < 300) {
                        if (a.responseText && a.responseText.errorCode == "800") {
                            window.location.href = "/touch/user/loginbymobile?forward=" + escape(location.href)
                        } else {
                            t.success && t.success(a.responseText, a.responseXML)
                        }
                    } else {
                        if (!t.isNotShowErrorAlert) {
                            switch (e + "") {
                            case "404":
                                alert("抱歉！好像网络出问题了，请检查您的网络设置");
                                break;
                            case "500":
                                alert("抱歉！好像系统有异常！请联系管理员解决");
                                break;
                            default:
                                alert("抱歉！可能系统出现异常或网络质量不好");
                                break
                            }
                        }
                        t.error && t.error(e)
                    }
                    t.complete && t.complete(a.responseText, e)
                }
            }
            ;
            if (t.type == "GET") {
                a.open("GET", t.url + "?" + e, t.async);
                a.setRequestHeader("x-requested-with", "XMLHttpRequest");
                a.send(null)
            } else if (t.type == "POST") {
                a.open("POST", t.url, t.async);
                a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                a.setRequestHeader("x-requested-with", "XMLHttpRequest");
                a.send(e)
            }
        }
        t.exports = o
    }(t.exports, t, e);
    e.____MODULES["153b7aa5c1d187fe7c4e96e56858d461"] = t.exports
}
)(this);
(function(i) {
    var e = {
        id: "25c77dd01e7646097e07e5ad43f14132",
        filename: "index.js",
        exports: {}
    };
    if (!i.____MODULES) {
        i.____MODULES = {}
    }
    var t = function(e, t, a) {
        t.exports = i.____MODULES["153b7aa5c1d187fe7c4e96e56858d461"]
    }(e.exports, e, i);
    i.____MODULES["25c77dd01e7646097e07e5ad43f14132"] = e.exports
}
)(this);
(function(n) {
    var e = {
        id: "5a0b8a8150e700c0bff3fa6b88cb470c",
        filename: "index.es",
        exports: {}
    };
    if (!n.____MODULES) {
        n.____MODULES = {}
    }
    var t = function(e, t, a) {
        "use strict";
        var f = function() {
            function i(e, t) {
                for (var a = 0; a < t.length; a++) {
                    var i = t[a];
                    i.enumerable = i.enumerable || false;
                    i.configurable = true;
                    if ("value"in i)
                        i.writable = true;
                    Object.defineProperty(e, i.key, i)
                }
            }
            return function(e, t, a) {
                if (t)
                    i(e.prototype, t);
                if (a)
                    i(e, a);
                return e
            }
        }();
        function u(e, t) {
            if (!(e instanceof t)) {
                throw new TypeError("Cannot call a class as a function")
            }
        }
        var p = n.____MODULES["70b72683c19a23f446551c351d15254b"];
        var w = n.____MODULES["25c77dd01e7646097e07e5ad43f14132"];
        var i = 1500;
        var g = function g(e) {
            return p.inform(e, i)
        };
        var r = null;
        var O = function O(e) {
            if (r) {
                clearTimeout(r)
            } else {
                r = setTimeout(function() {
                    return window.location.href = e
                }, i)
            }
        };
        var E = function E(e) {
            return window.location.href = e
        };
        var o = function() {
            function e() {
                u(this, e);
                this.id = window.PAGE_DATA && window.PAGE_DATA.fOrderId;
                this.depositeOrderId = 0;
                this.os = window.PAGE_DATA && window.PAGE_DATA.os;
                this.payType = "";
                this.data = window.PAGE_DATA && window.PAGE_DATA.jsPayData;
                this.$parent = document.getElementById("js-pay");
                this.$btn = this.$parent.querySelectorAll(".js-pay-item");
                this.$loading = this.$parent.querySelector(".js-loading");
                this.$confirmModal = document.getElementById("js-confirm-modal");
                this.$confirmWrapper = document.getElementById("js-confirm-wrapper");
                this.$confirmSuccessBtn = document.getElementById("js-confirm-success");
                this.$confirmErrorBtn = document.getElementById("js-confirm-error");
                this.isCommit = false;
                this.mount()
            }
            f(e, [{
                key: "mount",
                value: function i() {
                    var t = this;
                    var a = function a(e) {
                        t.$btn[e].addEventListener("click", function() {
                            t.payType = t.$btn[e].getAttribute("data-type");
                            t.checkOnline()
                        })
                    };
                    for (var e = 0; e < this.$btn.length; e++) {
                        a(e)
                    }
                    this.$confirmSuccessBtn.addEventListener("click", function(e) {
                        return t.getPayStatus(1)
                    });
                    this.$confirmErrorBtn.addEventListener("click", function(e) {
                        return t.getPayStatus(2)
                    })
                }
            }, {
                key: "showConfirmModal",
                value: function a() {
                    this.$confirmModal.style.display = "block";
                    this.$confirmWrapper.style.display = "block";
                    var e = navigator.userAgent.toUpperCase();
                    var t = e.indexOf("MI") > -1;
                    if (t) {
                        setTimeout(function() {
                            document.getElementById("js-mi-browser-render").innerHTML = (new Date).getTime()
                        }, 1e3)
                    }
                }
            }, {
                key: "closeConfirmModal",
                value: function t() {
                    this.$confirmModal.style.display = "none";
                    this.$confirmWrapper.style.display = "none"
                }
            }, {
                key: "getPayStatus",
                value: function r(n) {
                    var s = this;
                    var e = {
                        url: "/napi/cashier/ajaxGetPayStatus",
                        data: {
                            depositeOrderId: this.depositeOrderId
                        },
                        success: function c(e) {
                            try {
                                var t = JSON.parse(e);
                                var a = t.errorCode
                                  , i = t.data
                                  , r = t.msg;
                                if (a == 0) {
                                    if (n == 1) {
                                        if (i.payResult) {
                                            window.location.href = s.data.successJump
                                        } else {
                                            s.closeConfirmModal();
                                            p.inform("订单还未支付，请重新支付", 1e3);
                                            setTimeout(function() {
                                                window.location.reload()
                                            }, 1e3)
                                        }
                                    } else {
                                        if (i.payResult) {
                                            window.location.href = s.data.successJump
                                        } else {
                                            s.closeConfirmModal();
                                            window.location.reload()
                                        }
                                    }
                                } else {
                                    p.inform(r, 1e3)
                                }
                            } catch (o) {
                                p.inform("查询订单状态失败", 1e3)
                            }
                        },
                        error: function t() {
                            p.inform("查询订单状态失败", 1e3)
                        }
                    };
                    w(e)
                }
            }, {
                key: "closeLoading",
                value: function o() {
                    this.$loading.style.display = "none"
                }
            }, {
                key: "openLoading",
                value: function n() {
                    this.$loading.style.display = "flex"
                }
            }, {
                key: "checkOnline",
                value: function s() {
                    var t = this;
                    if (!this.isCommit) {
                        this.isCommit = true;
                        this.openLoading();
                        window.checkOnLine();
                        if (window.onLine) {
                            this.checkOrder()
                        } else {
                            window.checkOffLine("https://www.baidu.com", function(e) {
                                if (e) {
                                    t.checkOrder()
                                } else {
                                    t.closeLoading();
                                    t.isCommit = false;
                                    p.inform("网络不给力，请检查您的网络设置")
                                }
                            })
                        }
                    }
                }
            }, {
                key: "checkOrder",
                value: function c() {
                    var f = this;
                    var u = {
                        fOrderId: this.id,
                        orderId: this.data.orderId
                    };
                    var e = {
                        url: "/napi/cashier/ajaxCheckOrder",
                        type: "post",
                        data: u,
                        success: function p(e) {
                            var t = JSON.parse(e);
                            if (Number(t.errorCode) == 0) {
                                var a = t.data
                                  , i = a.isSuccess
                                  , r = a.errorCode
                                  , o = a.msg;
                                if (i) {
                                    f.payOrder()
                                } else {
                                    var n = f.data
                                      , s = n.successJump
                                      , c = n.timeoutJump
                                      , d = n.payFailJump;
                                    var l = d;
                                    Number(r) == 1003 && (l = c);
                                    Number(r) == 1006 && (l = s);
                                    f.isCommit = false;
                                    f.closeLoading();
                                    g(o);
                                    O(l)
                                }
                            } else {
                                f.isCommit = false;
                                f.closeLoading();
                                g(t.msg || "抱歉！系统出问题了，请稍后尝试");
                                window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面ajaxCheckOrder接口异常，环境" + f.data.js_os + ",参数" + JSON.stringify(u) + ",返回值" + e);
                                O(f.data.payFailJump)
                            }
                        },
                        error: function t(e) {
                            f.isCommit = false;
                            f.closeLoading();
                            g("抱歉！系统出问题了，请稍后尝试");
                            window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面ajaxPayOrder网络错误，环境" + f.data.js_os + ",参数" + JSON.stringify(u));
                            O(f.data.payFailJump)
                        }
                    };
                    w(e)
                }
            }, {
                key: "payOrder",
                value: function d() {
                    var b = this;
                    var t = {
                        fOrderId: this.id,
                        onlinePayType: this.payType
                    };
                    if (this.os === "wx") {
                        t.otherInfo = {
                            wxOpenId: this.data.openId
                        }
                    }
                    var e = {
                        url: "/napi/cashier/ajaxPayOrderThirdWay",
                        type: "post",
                        data: t,
                        success: function v(e) {
                            var t = JSON.parse(e);
                            var a = t.errorCode
                              , i = t.data
                              , r = t.msg;
                            if (a + "" == "0") {
                                var o = t.data
                                  , n = o.url
                                  , s = o.result
                                  , c = o.depositeOrderId
                                  , d = o.successJump
                                  , l = o.timeoutJump
                                  , f = o.payFailJump;
                                var u = s - 0;
                                b.closeLoading();
                                b.isCommit = false;
                                if (u == 1) {
                                    if (b.os == "touch") {
                                        if (b.payType == "WEIXIN" && c) {
                                            b.depositeOrderId = c;
                                            b.showConfirmModal();
                                            var p = window.setInterval(function() {
                                                var e = {
                                                    url: "/napi/cashier/ajaxGetPayResult",
                                                    type: "get",
                                                    data: {
                                                        depositeOrderId: c
                                                    },
                                                    isNotShowErrorAlert: true,
                                                    success: function success(t) {
                                                        var a = JSON.parse(t);
                                                        if (a.errorCode == 0 && a.data.res == 1) {
                                                            window.clearInterval(p);
                                                            p = null;
                                                            E(d)
                                                        }
                                                    },
                                                    error: function t() {
                                                        window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面轮训接口网络错误，环境" + this.data.js_os)
                                                    }
                                                };
                                                w(e)
                                            }, 2e3)
                                        }
                                        var m = navigator.userAgent;
                                        if (m.indexOf("baidubrowser") > -1 || m.indexOf("baiduboxapp") > -1) {
                                            window.__catchErrorLog("napi_pay_log", "唤起微信支付的url为: " + n)
                                        }
                                        window.location.href = n
                                    }
                                    if (b.os === "wx") {
                                        if (b.payType == "WEIXIN" && /MicroMessenger/i.test(navigator.userAgent)) {
                                            b.jsApiData = t.data.outParams;
                                            if (typeof WeixinJSBridge == "undefined") {
                                                if (document.addEventListener) {
                                                    document.addEventListener("WeixinJSBridgeReady", b.jsApiCall, false)
                                                } else if (document.attachEvent) {
                                                    document.attachEvent("WeixinJSBridgeReady", b.jsApiCall);
                                                    document.attachEvent("onWeixinJSBridgeReady", b.jsApiCall)
                                                }
                                            } else {
                                                b.jsApiCall()
                                            }
                                        }
                                        if (b.payType != "WEIXIN") {
                                            window.location.href = n
                                        }
                                    }
                                } else if (u == 2) {
                                    g("已支付，请勿重新提交");
                                    O(n)
                                } else if (u == 3) {
                                    g("您的账户优惠券不可用，请确认后重新提交");
                                    var y = "/napi/cashier?orderId=" + orderId + "&className=" + className + "&random=" + (new Date).getTime();
                                    O(y)
                                } else if (u == 4) {
                                    g("支付超时，请重新提交");
                                    O(n)
                                } else {
                                    var _ = r || "支付失败";
                                    var h = n || b.data.payFailJump;
                                    g(_);
                                    window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面ajaxPayOrderThirdWay返回数据错误，环境" + b.data.js_os + ",参数" + JSON.stringify(i) + ",返回值" + e);
                                    O(h)
                                }
                            } else {
                                window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面ajaxPayOrderThirdWay接口异常，环境" + b.data.js_os + ",参数" + JSON.stringify(i) + ",返回值" + e);
                                b.isCommit = false;
                                b.closeLoading();
                                g(r || "抱歉！系统出问题了，请稍后尝试");
                                O(b.data.payFailJump)
                            }
                        },
                        error: function a(e) {
                            b.isCommit = false;
                            b.closeLoading();
                            g("抱歉！系统出问题了，请稍后尝试");
                            window.__catchErrorLog("napi_cashier", "收银台选择支付方式页面ajaxPayOrderThirdWay网络错误，环境" + b.data.js_os + ",参数" + JSON.stringify(t));
                            O(b.data.payFailJump)
                        }
                    };
                    w(e)
                }
            }, {
                key: "jsApiCall",
                value: function l() {
                    if (this.jsApiData) {
                        var e = this.jsApiData;
                        var t = this.data.successJump;
                        WeixinJSBridge.invoke("getBrandWCPayRequest", e, function(e) {
                            WeixinJSBridge.log(e.err_msg);
                            if (e.err_msg == "get_brand_wcpay_request:ok") {
                                E(t)
                            } else {}
                        })
                    } else {
                        this.closeLoading();
                        g("订单支付失败，请重新提交");
                        O(this.data.payFailJump)
                    }
                }
            }]);
            return e
        }();
        window.onload = function() {
            return new o
        }
    }(e.exports, e, n);
    n.____MODULES["5a0b8a8150e700c0bff3fa6b88cb470c"] = e.exports
}
)(this);
(function(i) {
    var e = {
        id: "39d48a620942768cd97b7296e619028b",
        filename: "pay.js",
        exports: {}
    };
    if (!i.____MODULES) {
        i.____MODULES = {}
    }
    var t = function(e, t, a) {
        i.____MODULES["5a0b8a8150e700c0bff3fa6b88cb470c"]
    }(e.exports, e, i);
    i.____MODULES["39d48a620942768cd97b7296e619028b"] = e.exports
}
)(this);
